<template>
	<!-- <view class="wrap">
		<view class="add item" v-if="dataList.bank_card">
			<view class="cartname">
				{{dataList.car_name}}
			</view>
			<view class="carNum">
				{{dataList.bank_card | filte}} 
			</view>
		</view>
		<view class="add" @click="addBank" v-else>
			<image class="img" src="../../../static/plus.png" mode=""></image>
			<text>添加银行卡</text>
		</view>
	</view> -->
	<view class="bindBox">
		<view class="topBox" >
			<image :src=" baseurl + '/image/bindIcon2.png'" mode="widthFix"></image>
			<text>已绑定的银行卡</text>
		</view>
		
		<!-- 没有银行卡 -->
		<view class="" v-if="dataList.bank_card">
			<view class="cartname">
				{{dataList.car_name}}
			</view>
			<view class="carNum">
				{{dataList.bank_card | filte}} 
			</view>
		</view>
		<!-- 有银行卡 -->
		<view class="" v-else>
			<view class="midBox" >
				<image :src=" baseurl + '/image/bindIcon3.png'" mode="widthFix"></image>
				<text>暂无绑定银行卡</text>
			</view>
			<view class="addBut" @click="addBank" >
				<text>添加银行卡</text>
			</view>
		</view>
		
	</view>
</template>

<script>
	import baseurl from "@/config.js"
	export default {
		data() {
			return {
				baseurl:'',
				dataList:''
			}
		},
		created(){
			this.baseurl = baseurl.app_url;
		},
		filters:{
			filte(value){
				let lastFourChars = value.substring(value.length - 4);
				return '**** **** **** '+lastFourChars
			}
		},
		mounted() {
			this.select()
		},
		methods: {
			select(){
				let self = this
				self._get('withhold.add/shop',{},function(res){
					self.dataList = res.data
				})
			},
			addBank(){
				uni.navigateTo({
					url:'/pages/user/bindBank/addBank'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.topBox image {
		width: 100%;
		position: relative;
	}
	.topBox text {
		font-weight: 900;
		font-size: 40rpx;
		position: absolute;
        bottom: 1200rpx;
		left: 30rpx;
	}
	.midBox image {
		width: 100%;
	}
	.midBox text {
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.addBut {
		margin: 70rpx auto ;
		width: 682rpx;
		height: 88rpx;
		background: linear-gradient(#05C8BE 0%, #6FD9D7 100%);
		border-radius: 44rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.addBut text{
		font-weight: 400;
		margin: auto;
		font-size: 35rpx;
	}
	.wrap{
		padding: 20rpx;
		padding-top: 0;
		.add{
			background-color: white;
			border-radius: 10rpx;
			height: 130rpx;
			display: flex;
			align-items: center;
			padding: 15rpx;
			margin-top:20rpx;
			.img{
				width: 30px;
				height: 30px;
				background-size: 100%;
			}
			text{
				font-weight: bold;
				font-size: 32rpx;
			}
		}
		.item{
			background-color: #cfbfb9;
			display: block;
			.cartname{
				font-size: 34rpx;
				margin-top: 14rpx;
			}
			.carNum{
				text-align: right;
				font-size: 40rpx;
				margin-top: 28rpx;
			}
		}
	}
</style>
